package com.summer.roman;

import java.util.HashMap;

public class SmartRecognizer {
	
	private HashMap<String,Class<? extends Letter>> commodityMap = new HashMap<>();
	
	private Letter letter = null;
	
	public void loadCommodityInfo(){
		commodityMap.put("glob", I.class);
		commodityMap.put("prok", V.class);
		commodityMap.put("pish", X.class);
		commodityMap.put("tegj", L.class);
	}
	
	public void scanning(String commodity) throws Exception{
		
		Class<? extends Letter> cls = commodityMap.get(commodity);
		
		if(cls == null)
			throw new Exception("");
		if(letter==null){
			letter = cls.newInstance();
			return;
		}
		
		Letter nextLetter = cls.newInstance(); 
		letter.setNextLetter(nextLetter);
	}
	
	public void sorting(){
		
	}
	
	
}
